//
//  HMHomeTabSectionHeader.m
//  HowToDo
//
//  Created by 胡坤 on 2017/1/4.
//  Copyright © 2017年 KY. All rights reserved.
//

#import "HMHomeTabSectionHeader.h"
#import "HMTopILView.h"

@interface HMHomeTabSectionHeader ()
//组头频道标签
@property (weak, nonatomic) IBOutlet UILabel *sectionChannelNameLable;
//底部分割线
@property (weak, nonatomic) IBOutlet UIView *lineView;
@property (weak, nonatomic) IBOutlet UIImageView *functionIconView;
@property (weak, nonatomic) IBOutlet UILabel *functionLable;
@property (weak, nonatomic) IBOutlet UIButton *coverBTn;
@end
@implementation HMHomeTabSectionHeader
+(instancetype)initWithNib:(NSString*)nibName
{
    return [[[NSBundle mainBundle]loadNibNamed:nibName owner:nil options:nil] lastObject];
}
-(void)awakeFromNib
{
    [super awakeFromNib];
    
}
//设置不同的样式
-(void)setChannelName:(NSString *)channeName FunctionName:(NSString *)functionName FunctionIcon:(UIImage *)img BottomLineHidden:(BOOL)isHidden
{
    self.sectionChannelNameLable.text = channeName;
    self.functionIconView.image = img;
    self.functionLable.text = functionName;
    self.lineView.hidden = isHidden;
    [self.functionIconView mas_makeConstraints:^(MASConstraintMaker *make)
     {
        make.right.equalTo(self);
        make.centerY.equalTo(self.sectionChannelNameLable);
    }];
    [self.functionLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.functionIconView.mas_left).mas_offset(-10);
        make.centerY.equalTo(self.functionIconView);
        
    }];
}
-(void)takeIconImgFrontOfFunctionLable
{
    [self.functionLable mas_remakeConstraints:^(MASConstraintMaker *make)
    {
        make.centerY.equalTo(self.sectionChannelNameLable);
        make.right.equalTo(self).mas_offset(-15);
    }];
    
    [self.functionIconView mas_remakeConstraints:^(MASConstraintMaker *make)
    {
        make.centerY.equalTo(self.sectionChannelNameLable);
        make.right.equalTo(self.functionLable.mas_left).offset(-10);
    }];
}
- (IBAction)headerFunctionButtonAction:(UIButton *)sender
{
    self.clickCurrentSectionHeader(self.section);
}
@end
